package model

import (
	"gorm.io/gorm"
	__ "video-srv/basic/proto/rpc"
)

type Member struct {
	gorm.Model
	Title            string `gorm:"type:varchar(30)" json:"title"`
	Price            int    `gorm:"type:int" json:"price"`
	Duration         int    `gorm:"type:int" json:"duration"`
	MemberExpireTime int    `gorm:"type:int" json:"memberExpireTime"`
}

func (m *Member) IsMember(db *gorm.DB, id int) error {
	return db.Where("id = ?", id).First(&m).Error
}
func (m *Member) GetMember(db *gorm.DB) (list []*__.MemberList, err error) {
	err = db.Model(&m).Select("title,price,duration,member_expire_time").Find(&list).Error
	return
}
